<template>
	<div>
		<!--表格-->
		<el-table :data="userList" stripe>
			<!-- 其他列名 -->
			<el-table-column v-for="(column,index) in columns" :key="index" align="center" :label="column.label"
				:prop="column.prop" :width="column.width"></el-table-column>
		</el-table>
		<!--分页-->
		<div class="toolbar" style="padding:10px;">
			<el-pagination layout="total, prev, pager, next" @current-change="refreshPageRequest"
				:current-page="pageData.pageNum" :page-size="pageData.pageSize" :total="pageData.totalSize"
				style="float:right;">
			</el-pagination>
		</div>
	</div>
</template>

<script>
	import columns from '../../util/table/columns.js'
	export default {
		data() {
			return {
				columns: columns.userColumns,
				//分页请求
				pageRequest: {
					currentPage: 1,
					pageSize: 8,
					params: {}
				},
				//结果返回的分页数据
				pageData: {},
				//用户列表
				userList: []
				
			}
		},
		mounted() {
			this.loadUser()
		},
		methods: {
			//加载全部用户
			loadUser() {
				let _this = this;
				_this.$axios({
					method: 'post',
					url: '/user/listAllUserForManager',
					data: _this.pageRequest
				}).then((resp) => {
					_this.pageData = resp.data
					_this.userList = resp.data.content
				})
			},
			//分页查询
			refreshPageRequest(val) {
				this.pageRequest.currentPage = val
				this.pageRequest.params.phone = this.search.phone
				this.loadSeller()
			},
			//搜索
			onBtnSearch() {
				this.pageRequest.pageNum = 1
				this.pageRequest.params.phone = this.search.phone
				this.loadSeller()
			}
		}
	}
</script>

<style scoped>
</style>
